import { IChildren, IResult, ITaskList, ITaskStatusBody } from "../interfaces";
import { instance } from "../utils";

/** 任务频道列表 */
export const fetchRecords = (
  spaceId: string,
  channelId: string,
  body
): Promise<IResult<ITaskList[] | IChildren[]>> => {
  return instance
    .post(`/space/${spaceId}/channel/${channelId}/view/default/records`, body)
    .then(({ data }) => data);
};
/** 任务频道修改状态 */
export const updateTaskStatus = (
  spaceId: string,
  channelId: string,
  body: ITaskStatusBody
): Promise<IResult<any[]>> => {
  return instance
    .put(`/space/${spaceId}/channel/${channelId}/view/default/meta`, body)
    .then(({ data }) => data);
};
